package com.corx.network.core.type;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 设备运行状态
 * @author gx
 * @version 1.0.0
 */
@Getter
@AllArgsConstructor
public enum DeviceStateEnum {
    /**
     * 在线
     */
    ONLINE("在线", "online"),
    /**
     * 离线
     */
    OFFLINE("离线", "offline");

    /**
     * 名称
     */
    private final String name;


    /**
     * 运行状态
     */
    private final String state;


    /**
     * @param state state
     * @return DeviceState
     */
    public static DeviceStateEnum getByType(String state) {

        for (DeviceStateEnum value : values()) {
            if (value.state.equalsIgnoreCase(state)) {
                return value;
            }
        }
        return null;
    }
}
